import { NestFactory } from '@nestjs/core';
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
import { AppModule } from './modules/app/app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { ResponseInterceptor } from './interceptors/response/response.interceptor';

async function bootstrap() {
  const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule,{
    transport: Transport.TCP,
    options: {
      port: 9091,
    },
  });
//   app.enableCors();
//   app.setGlobalPrefix('api');

//   app.useGlobalInterceptors(new ResponseInterceptor())

//   const config = new DocumentBuilder()
//     .setTitle('Template Store API')
//     .setDescription('Template Store API')
//     .setVersion('1.0')
//     .addTag('Template Store') // Optional: Add tags for grouping
//     .addBearerAuth() // Add authentication if needed
//     .build();
    
//   const document = SwaggerModule.createDocument(app, config);
//   SwaggerModule.setup('doc', app, document); // 'api' is the endpoint path


  await app.listen();
}
bootstrap();
